package ly.jobdu;

import java.util.ArrayList;
import java.util.Scanner;

public class Q1057ModeNum {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			String str = scanner.nextLine();
			modeNum(str);
		}
	}

	public static void modeNum(String str) {
		String[] strs = str.split(" ");
		int nums[] = new int[strs.length];
		for (int i = 0; i < nums.length; i++) {
			nums[i] = Integer.parseInt(strs[i]);
		}

		int[][] sets = new int[10][2];

		for (int j = 0; j < 10; j++) {
			int count = 0;
			for (int i = 0; i < nums.length; i++) {
				if (nums[i] == j + 1) {
					count++;
				}
			}
			sets[j][0] = j + 1;
			sets[j][1] = count;
		}

		int maxNum = findMaxNum(sets);

		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < sets.length; i++) {
			if (sets[i][1] == maxNum) {
				list.add(sets[i][0]);
			}
		}

		System.out.println(findMinNum(list));
	}

	public static int findMaxNum(int[][] nums) {
		int max = 0;
		for (int i = 0; i < nums.length; i++) {
			if (nums[i][1] > max) {
				max = nums[i][1];
			}
		}
		return max;
	}

	public static int findMinNum(ArrayList<Integer> list) {
		int min = list.get(0);
		for (int i = 1; i < list.size(); i++) {
			if (list.get(i) < min) {
				min = list.get(i);
			}
		}
		return min;
	}
}
